// 字体样式变量
$family:"黑体";

// 颜色变量
$color-gray:#ececec;
$color-gray-deeper:#dfdfdf;
$color-gray-font:#838383;
$color-red-deeper:rgb(119, 2, 2);
$color-red:rgb(146, 1, 1);
$color-light-red:rgb(241, 113, 113);
$color-yellow:rgb(236, 195, 11);
$color-yellow-deeper:rgb(255, 208, 0);
$color-footer:#89d9f1;


// 字体大小变量
$small-size:.5rem;
$normal-size:1.5rem;
$big-size:2.5rem;
$bigest-size:3rem;

// 图标大小
$icon-width:7rem;
$icon-height:7rem;

@mixin button($color, $bgcolor:transparent, $bgcolor-hover:$bgcolor) {
    padding: .8rem;
    font-size: $small-size;
    font-family: $family;
    font-weight: 700;
    color: $color;
    background-color: $bgcolor;
    text-transform: uppercase;
    border: 1px solid transparent;
    border-radius: 2rem;
    outline: none;


    &:hover {
        outline: none;
        cursor: pointer;
        background-color: $bgcolor-hover;
    }
}

// 混合类，用于居中对象
@mixin center() {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column
}

// 生成随机颜色
@function random-color() {
    @return rgb(random(255), random(255), random(255));
}

html,
body {
    font-size: 16px;
}

.center {
    @include center();
}

h2 {
    font-size: $big-size;
}

h3 {
    font-size: $normal-size;
}

h2,
h3,
p {
    font-family: $family;
    margin: 0;
    font-size: 1rem;
}


main {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    // grid-template-rows: repeat(7, auto);
    gap: .5rem;
    grid-template-areas:
        "s1 s1 s2"
        "s3 s4 s4"
        "s5 s5 s5"
        "s6 s7 s7"
        "s8 s8 s8"
        "s9 s9 s10"
        "s11 s11 s11";
}


#s1 {
    grid-area: s1;
    background: url("../images/1.jpeg") no-repeat center center;
    background-size: cover;
    display: flex;
    align-items: center;
    padding: 5% 10%;

    p {
        font-size: $small-size;
        font-family: $family;
        font-weight: 700;
        color: white;
        margin-bottom: .5rem;
    }

    hr {
        margin: 0;
        width: 3rem;
        border: 1px solid yellow;
    }

    h2 {
        color: white;
        text-transform: capitalize;
        font-size: $big-size;
        margin: 1rem 0;
        font-family: Arial, Helvetica, sans-serif;
        font-weight: 100;
    }

    button {
        @include button(white, $bgcolor-hover:$color-yellow);
        border: 1px solid white;
    }
}

#s2 {
    grid-area: s2;
    display: flex;
    padding: 1rem 3rem;
    justify-content: center;
    align-items: center;
    background-color: $color-yellow;
    text-align: center;
    color: white;

    #up-icons {
        width: 7rem;
        height: 7rem;
        display: block;
        margin: auto;
        margin-bottom: 1rem;
    }

    h2,
    h3 {
        text-transform: uppercase;
    }

    h3 {
        font-size: $small-size;
        font-weight: 400;

        span {
            font-weight: 700;
        }

        padding-bottom: 1rem;
        border-bottom: 3px solid white;
    }

    p {
        font-size: .3rem;
        margin: 1.5rem 0;
    }

    div>img {
        width: 2rem;
        height: 2rem;
        margin: 0 .5rem;
    }

}

#s3 {
    grid-area: s3;
    background-image: linear-gradient(rgba(251, 106, 131, 0.5), rgba(251, 106, 131, 0.5)), url("../images/2.jpeg");
    background-repeat: no-repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 2rem 2rem;

    img {
        width: $icon-width;
        height: $icon-height;
    }

    p {
        text-transform: uppercase;
        font-weight: 700;
    }
}

#s4 {
    background-color: $color-gray;

    grid-area: s4;
    display: flex;

    padding: 2rem 3rem;
    align-items: flex-start;

    div {
        width: 70%;

        h2 {
            font-weight: 400;
            font-size: $normal-size;
            text-transform: capitalize;
        }

        h3 {
            color: $color-red-deeper;
        }

        p {
            font-size: $small-size;
        }

        button {
            @include button(white, $color-red-deeper, $color-red)
        }

        ul {
            list-style-type: '+';
        }
    }

    img {
        margin-left: 1rem;
        height: 15rem;
        width: 12rem;
    }
}

#s5 {
    background: url("../images/4.jpeg") no-repeat center center;
    background-size: cover;
    grid-area: s5;
    padding: 0 1rem 1rem;

    p {
        font-size: .8rem;
    }


    .chapter {
        width: 60%;
        display: flex;
        margin: auto;

        button {
            display: inline-block;
            flex: 1 1 auto;
            margin: 5rem 2px;
            height: 4rem;
            width: 8rem;
            background-color: $color-gray;
            border: none;
            text-transform: uppercase;
            font-size: .8rem;
            font-family: "黑体";
            font-weight: 700;


            &:hover {
                outline: none;
                cursor: pointer;
                background-color: #dfdfdf;
            }

            &:focus {
                color: $color-yellow;
                outline: none;
            }
        }
    }

    .items {
        display: grid;
        grid-template-rows: repeat(5, auto);
        row-gap: 2px;
        width: 80%;

        margin: auto;


        .item {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 1rem 1rem 1rem 1rem;
        }

        &>*:nth-child(2n) {
            background-color: $color-gray-deeper;

        }

        &>*:nth-child(2n+1) {
            background-color: $color-gray;
        }

        & .side-world:nth-child(3n) {
            color: random-color();
        }

        & .side-world:nth-child(3n+1) {
            color: random-color();
        }

        & .side-world:nth-child(3n+2) {
            color: random-color();
        }



        .day {
            flex: 0 0 auto;
            width: 4rem;
            height: 4rem;
            background-color: $color-yellow;
            color: white;
            font-family: "黑体";
            font-weight: 700;
            @extend .center;


        }

        .world {
            flex: 1 0 auto;
            @extend .center;

            & p:nth-child(1) {
                text-transform: uppercase;
                font-weight: 700;
            }

            & p:nth-child(2) {
                text-transform: capitalize;
            }
        }

        .time {
            color: $color-gray-font;
            flex: 3 0 auto;
            @extend .center;
        }

        .choose {
            flex: 5 0 auto;
            @extend .center;
        }

        button {
            @include button(black, white, $color-gray-font);
            margin: auto 1rem auto auto;
        }
    }
}

#s6 {
    grid-area: s6;
    background: url("../images/5.jpeg") center center no-repeat;
    background-size: cover;
    min-height: 20rem;
}

#s7 {
    grid-area: s7;
    background: linear-gradient(rgba(236, 236, 236, 1), rgba(236, 236, 236, 1)), url("../images/5.jpeg");
    background-size: cover;
    @include center();
    padding: 5% 10%;

    text-transform: capitalize;

    img {
        width: $icon-width;
        height: $icon-height;
        border-radius: 50%;
    }

    & p:nth-of-type(1) {
        margin-top: 1rem;
        font-size: $small-size;
        color: $color-red;
    }

    & p:nth-of-type(2) {
        font-weight: 700;
    }

    & p:nth-of-type(3) {
        color: $color-gray-font;
        text-transform: none;
    }

    .dot {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        border: 1px solid $color-light-red;
        background-color: $color-light-red;
        margin: 2rem .5rem;
    }

    .dot-active {
        background-color: $color-red;
    }
}

#s8 {
    grid-area: s8;
    display: flex;

    &>* {
        flex: 1;
        height: 15rem;
        color: white;
        text-transform: uppercase;
        font-weight: 700;
        @include center();

        img {
            width: $icon-width;
            height: $icon-height;
        }

        p {
            margin-top: 1rem;
            font-size: $small-size;
        }

    }


    &> :nth-child(1) {
        background-color: $color-gray-font;
    }

    &> :nth-child(2) {
        background-color: $color-yellow;
    }

    &> :nth-child(3) {
        background-color: $color-light-red;
    }

    &> :nth-child(4) {
        background-color: $color-red;
    }
}

#s9 {
    background: url("../images/7.jpeg") center center no-repeat;
    background-size: cover;
    grid-area: s9;
    @include center();
    padding: 2rem 4rem;

    &>div {
        width: 90%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: 1fr 4fr;
        gap: 1rem;
    }

    button {
        @include button(white, $color-yellow, $color-yellow-deeper);
        width: max-content;

    }

    input {
        min-width: 50px;
        background-color: rgba(214, 214, 214, .2);
        border: none;
        border-bottom: 1px solid white;
        color: white;
        outline: none;
        padding: .8rem 1rem;
        font-size: 1rem;

        &::placeholder {
            font-size: 1rem;
            color: $color-gray-font;
        }
    }


    textarea {
        grid-column: 1 / 4;
        background-color: rgba(214, 214, 214, .2);
        border: none;
        border-bottom: 1px solid white;
        color: white;
        outline: none;
        padding: .5rem 1rem;
        font-size: 1rem;
    }
}

#s10 {
    grid-area: s10;
    background-color: $color-yellow;
    color: white;
    @include center();

    img {
        width: $icon-width;
        height: $icon-height;
    }

    p {
        text-transform: uppercase;
        font-weight: 700;
    }
}

#s11 {
    grid-area: s11;
    background-color: $color-footer;

    @include center();
    padding: 1.5rem;

    span {
        color: $color-red;
    }
}


@media screen and (max-width: 1000px) {
    main {
        grid-template-columns: repeat(3, 1fr);
        grid-template-areas:
            "s1 s1 s1"
            "s2 s2 s2"
            "s3 s3 s3"
            "s4 s4 s4"
            "s5 s5 s5"
            "s6 s6 s6"
            "s7 s7 s7"
            "s8 s8 s8"
            "s9 s9 s9"
            "s10 s10 s10"
            "s11 s11 s11";
    }

    #s4 {
        @include center();
        padding: 1rem;

        &>div {
            @include center();
            margin-bottom: 1rem;
            text-align: center;
        }

        ul {
            padding: 0;
        }

        img {
            margin: 0;
        }
    }
}


@media screen and (max-width: 700px) {
    html,body {
        font-size: 12px;
    }

    #s5 {

        .chapter,
        .items {
            width: auto;
        }

    }

    #s9 {
        padding: 1rem 1rem;

        &>div {
            width: 100%;
            grid-template-columns: 1fr;
            grid-template-rows: 1fr 1fr 1fr 4fr;

            textarea {
                grid-column: 1/2;
            }
        }
    }

    #s8 {
        @include center();

        align-items: stretch;
        & > * {
            padding: 1rem;
        }
    }

    #s10 {
        padding: 1rem;
    }

    #s5 {
        .chapter {
            @include center();
            & > button {
                margin: .5rem 1rem;
                width: 12rem;
            }
        }

        .item {
            @include center();

            & > div {
                margin: 1rem;
            }
        }
    }

}